package top.ruanlitao.shortlink.project.common.handler;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * 全局异常捕获处理器
 */
@Slf4j
@NoArgsConstructor
public class GlobalUncaughtExceptionHandler implements Thread.UncaughtExceptionHandler {

    @Getter
    private static final GlobalUncaughtExceptionHandler instance = new GlobalUncaughtExceptionHandler();

    @Override
    public void uncaughtException(Thread t, Throwable e) {
        log.error("未捕获的异常发生: {}", e.getMessage(), e);
    }
}